{extend name="base/base" /}

<!-- 头部区域（水平导航） -->
{block name="menu_h"}
    {if condition="count($user.menu.menu_h.menu_h_s) > 0"}
    <li class="layui-nav-item layui-hide-xs">
        <a href="javascript:;" layadmin-event="more">查询中心</a>
        <dl class="layui-nav-child">
        {foreach $user.menu.menu_h.menu_h_s as $key => $value}
            {if condition="isset($value['sub'])"}
                {foreach $value['sub'] as $k => $v}
                    {if condition="$v.type eq 'select'"}
                        <dd class="nav-item"><a lay-href="{$v.url}" data-id="{$v.id}" data-title="{$v.alt}" data-type="tabAdd">{$v.alt}</a></dd>
                    {/if}
                {/foreach}
            {else/}
                {if condition="$value.type eq 'select'"}
                    <dd class="nav-item"><a lay-href="{$value.url}" data-id="{$value.id}" data-title="{$value.alt}" data-type="tabAdd">{$value.alt}</a></dd>
                {/if}
            {/if}
        {/foreach}
        </dl>
    </li>
    {/if}

    {if condition="count($user.menu.menu_h.menu_h_c) > 0"}
    <li class="layui-nav-item layui-hide-xs">
        <a href="javascript:;" layadmin-event="more">控制中心</a>
        <dl class="layui-nav-child">
            {foreach $user.menu.menu_h.menu_h_c as $key => $value}
                {if condition="isset($value['sub'])"}
                    {foreach $value['sub'] as $k => $v}
                        {if condition="$v.type eq 'contrl'"}
                            <dd class="nav-item"><a lay-href="{$v.url}" data-id="{$v.id}" data-title="{$v.alt}" data-type="tabAdd">{$v.alt}</a></dd>
                        {/if}
                    {/foreach}
                {else/}
                    {if condition="$value.type eq 'contrl'"}
                        <dd class="nav-item"><a lay-href="{$value.url}" data-id="{$value.id}" data-title="{$value.alt}" data-type="tabAdd">{$value.alt}</a></dd>
                    {/if}
                {/if}
            {/foreach}
        </dl>
    </li>
    {/if}
{/block}

<!-- 左侧导航区域（垂直导航） -->
{block name="menu_v"}
    <script type="text/javascript">
        var menudata = {$user.menu.menu_v|json_encode};
    </script>
    
{/block}


{block name="main"}
<div class="container">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-sm4 layui-col-md3">
            <div class="layui-card">
                <div class="layui-card-header line-left">当前会员数</div>
                <div class="layui-card-body layuiadmin-card-list">
                    <p class="layuiadmin-big-font">{$data.customer_total}</p>
                </div>
            </div>
        </div>
        <div class="layui-col-sm4 layui-col-md3">
            <div class="layui-card">
                <div class="layui-card-header line-left">当前会员余额</div>
                <div class="layui-card-body layuiadmin-card-list">
                    <p class="layuiadmin-big-font">{$data.customer_amount_total}</p>
                </div>
            </div>
        </div>
        <div class="layui-col-sm4 layui-col-md3">
            <div class="layui-card">
                <div class="layui-card-header line-left">当前会员可消费积分</div>
                <div class="layui-card-body layuiadmin-card-list">
                    <p class="layuiadmin-big-font">{$data.customer_scores_consumption_total}</p>
                </div>
            </div>
        </div>
        <div class="layui-col-sm4 layui-col-md3">
            <div class="layui-card">
                <div class="layui-card-header line-left">会员等级分布</div>
                <div class="layui-card-body layuiadmin-card-list">
                    <table class="layui-table">
                        <thead>
                            <tr>
                                <th>等级</th>
                                <th>用户量</th>
                            </tr> 
                        </thead>
                        <tbody>
                        {volist name="$data.customer_level" id="val"}
                            <tr><td>{$val.level}</td><td>{$val.total}</td></tr>
                        {/volist}
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="layui-col-sm12 layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header line-left">会员流失预警</div>
                <div class="layui-card-body layuiadmin-card-list">
                    <table class="layui-table">
                        <thead>
                            <tr>
                                <th>昵称</th>
                                <th>手机</th>
                                <th>上次消费</th>
                            </tr> 
                        </thead>
                        <tbody>
                        {volist name="data.customer_lose" id="val"}
                            <tr>
                                <td>{$val.nickname}</td>
                                <td>{$val.phonenum}</td>
                                <td>{$val.last_time}</td>
                            </tr>
                        {/volist}
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
{/block}

{block name="footer"}
{__block__}
{/block}


